package com.laikan.reader.core.view;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.widget.GridView;

public class MyGridView extends GridView {

    public MyGridView(Context context) {
        super(context);
        initView();
    }

    public MyGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyGridView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    private void initView() {
        // 去掉选中背景
        this.setSelector(new ColorDrawable(Color.TRANSPARENT));
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);
    }

//    @Override
//    public boolean onTouchEvent(MotionEvent ev) {
//        KLog.e("gv_booklist::", ev.getAction() + "  :::" + ev.toString());
//        float DownX = 0, DownY = 0;
//        float UpX = 0, UpY = 0;
//        switch (ev.getAction()) {
//            case MotionEvent.ACTION_DOWN:
//                DownX = ev.getX();//float DownX
//                DownY = ev.getY();//float DownY
//                break;
//            case MotionEvent.ACTION_MOVE:
//                UpX = ev.getX();//float DownX
//                UpY = ev.getY();//float DownY
//                break;
//            case MotionEvent.ACTION_UP:
//                UpX = ev.getX();//float DownX
//                UpY = ev.getY();//float DownY
//                break;
//            default:
//                break;
//
//        }
//
//        if ((UpY - DownY) > 50) {
//            KLog.e("gv_booklist::", "gv_booklist dong le !");
//            return false;
//        }else {
//            KLog.e("gv_booklist::", "< 50    ----------");
//            return false;
//        }
//    }
}
